<?php

namespace app\api\validate;

use think\Validate;

class Live extends Validate
{
    protected $rule = [
        ['title',         'require|length:1,64',      '请先输入直播标题|标题字数为1-64'],
        ['description',   'max:255',                  '直播描述字数不超过255'],
        ['live_id',       'require|number|>:0',       '请先选择直播|请先选择直播|请先选择直播'],
        ['type',          'require|number|>=:0',      '请先选择评论类型|请先选择评论类型|请先选择评论类型'],
        /*['content',       'require',                  '请先输入评论内容'],*/
        ['another_id',    'require|number|>:0',       '请先选择主播|请先选择主播|请先选择主播'],
        ['channel',       'require|number|>:0',       '请先选择频道|请先选择频道|请先选择频道'],
        ['orderid',       'require|number|>:0',       '订单缺失|订单缺失|订单缺失'],
        ['to_user',       'require|number|>:0',       '用户不存在|用户不存在|用户不存在'],
        ['types',         'require|number|in:1,2',    '类型有误|类型有误|类型有误'],
        ['anchor_id',     'require|number|>:0',       '请先选择主播|请先选择主播|请先选择主播'],
        ['audience_id',   'require|number|>:0',       '请先选择观众|请先选择观众|请先选择观众'],
        ['status',        'require|number',           '状态不正确|状态不正确'],
    ];
    
    protected $scene = [
        'begin'           => ['title', 'description'],
        'close'           => ['live_id'],
        'join'            => ['live_id'],
        'comment'         => ['live_id', 'type', 'content'],
        'liveDetail'      => ['live_id'],
        'giftRanking'     => ['live_id'],
        'toRequest'       => ['another_id', 'channel', 'orderid'],
        'returnRequest'   => ['another_id', 'channel', 'orderid'],
        'checkMic'        => ['to_user', 'types'],
        'createMic'       => ['orderid'],
        'contributeRank'  => ['anchor_id'],
        'micNotice'       => ['audience_id', 'live_id', 'status'],
        'starRanking'     => ['anchor_id'],
    ];
}
